package com.ourhours.message.enums;

/**
 * Description:MessageTypeEnum 消息类型枚举.
 *
 * @author chi.chen
 * @version V1.0
 * @since 2018/3/29
 */
public enum MessageTypeEnum {

    SMS(1, "短信"),
    EMAIL(2, "邮件"),
    APP_PUSH(3, "推送");


    private int code;
    private String content;

    private MessageTypeEnum(Integer code, String content) {
        this.code = code;
        this.content = content;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public static MessageTypeEnum fromCode(Integer type){
        if (null == type) {
            return null;
        }
        for (MessageTypeEnum supplierTypeEnum : values()) {
            if (type == supplierTypeEnum.getCode()) {
                return supplierTypeEnum;
            }
        }
        return null;
    }
}
